package com.ruoyi.flow.auth.menu;

import com.google.common.collect.Lists;

import java.util.List;

/**
 * 菜单类
 *
 * @Author: wtian
 * @Description:
 * @Date: Created in 19:06 2018/8/9
 * @Version: 1.0
 */
public class Menu {
    private String url;
    private String name;
    private String icon;
    private List<Menu> subMenus;

    public Menu(String name,String icon) {
        this.name = name;
        this.icon = icon;
        this.subMenus = Lists.newArrayList();
    }

    public Menu(String url, String name, String icon) {
        this.url = url;
        this.name = name;
        this.icon = icon;
        this.subMenus = Lists.newArrayList();
    }

    public Menu(String url, String name, String icon, List<Menu> subMenus) {
        this.url = url;
        this.name = name;
        this.icon = icon;
        this.subMenus = subMenus;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public List<Menu> getSubMenus() {
        return subMenus;
    }

    public void setSubMenus(List<Menu> subMenus) {
        this.subMenus = subMenus;
    }

    public void addSubMenu(Menu menu) {
        this.subMenus.add(menu);
    }

    @Override
    public String toString() {
        return "Menu{" +
                "url='" + url + '\'' +
                ", name='" + name + '\'' +
                ", icon='" + icon + '\'' +
                ", subMenus=" + subMenus +
                '}';
    }
}
